<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var arr = "what are you弄啥嘞";
    var lenght=0;
    var c=0;
    function fn() {
        for (var i = 0; i < arr.length; i++) {
            c = arr.charCodeAt(i);
            if (c>0&&c<127){
                lenght++
            } else {
                lenght+=2
            }
        }
        return c;
    }
    fn();
    console.log(lenght);
</script>
</body>
</html>